This article will introduce the use of levenshtein, a similarity calculation function of PHP.
Let's take a look at the levenshtein () function instructions in the manual:
The levenshtein () function returns the Levenshtein distance between two
Instructions for useLet's take a look at the levenshtein () function instructions in the manual:
The levenshtein () function returns the Levenshtein distance between two strings.
Levenshtein distance, also known as the editing distance, refers to
Instructions for useLet's take a look at the levenshtein () function instructions in the manual:
The levenshtein () function returns the Levenshtein distance between two strings.
Levenshtein distance, also known as the editing distance, refers to
Instructions for useLook at the description of the Levenshtein () function in the manual:
The Levenshtein () function returns the Levenshtein distance between two strings.
Levenshtein distance, also called edit distance, refers to the minimum
The function is mainly used to calculate the number of matching characters for two strings, or to calculate the similarity between the two strings (expressed in percentages ). Compared with the similar_text () function, the levenshtein () function
Title, the more detailed the better. Thanks, man.
levenshtein("Hello World","ello World");
It only takes 1 steps to add an ' H ' to the second argument! And of course return ' 1 '!This function is quite simple, but:
levenshtein("Hello World","ello
For example, the more detailed the question, the better. Thank you! {Code...}. It only requires adding & #039; H & #039; in the second parameter. Only one step is required! Of course, Return & #039; 1 & #039! This function is quite simple, but:
PHP improves the similar_text (), levenshtein (), and levenshtein functions for string similarity calculation.
Similar_text () Chinese character edition
Copy codeThe Code is as follows:// Split the stringFunction split_str ($ str ){Preg_match_all ("/
Instance
Calculates the Levenshtein distance between two strings:
", Echo Levenshtein ("Hello World", "Ello World", 10,20,30);? >
Definition and usage
The Levenshtein () function returns the Levenshtein distance between two strings.
Levenshtein
PHP improved calculation of string similarity function Similar_text (), Levenshtein (), Levenshtein
Similar_text () Chinese character edition
Copy the Code code as follows:Splitting a stringfunction Split_str ($STR) {Preg_match_all ("/./u", $str,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.